package org.ljy.transdemo.exception;


import lombok.extern.slf4j.Slf4j;
import org.ljy.transdemo.common.Result;
import org.springframework.web.bind.annotation.ControllerAdvice;
import org.springframework.web.bind.annotation.ExceptionHandler;
import org.springframework.web.bind.annotation.ResponseBody;

@Slf4j
@ResponseBody
@ControllerAdvice
public class ExceptionAdvice {

    @ExceptionHandler
    public Result exception(Exception e) {
        log.warn(e.getMessage());
        return Result.failed(e.getMessage());
    }

}
